package com.eco.fanliapp.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.eco.fanliapp.entity.AppWithdrawal;
import com.eco.fanliapp.vo.AppWithdrawalOfMode;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 提现记录 数据层
 * 
 * @author xiaoxx
 * @date 2019-05-14
 */
public interface AppWithdrawalMapper extends BaseMapper<AppWithdrawal>
{
	/**
     * 查询提现记录信息
     * 
     * @param id 提现记录ID
     * @return 提现记录信息
     */
	 AppWithdrawal selectAppWithdrawalById(Long id);
	
	/**
     * 查询提现记录列表
     *
     * @return 提现记录集合
     */
	 List<AppWithdrawal> selectAppWithdrawalList(HashMap<String, Object> hashMap);

	/**
     * 新增提现记录
     *
     * @param appWithdrawal 提现记录信息
     * @return 结果
     */
	public int insertAppWithdrawal(AppWithdrawal appWithdrawal);

	/**
     * 修改提现记录
     *
     * @param appWithdrawal 提现记录信息
     * @return 结果
     */
	public int updateAppWithdrawal(AppWithdrawal appWithdrawal);

	/**
     * 删除提现记录
     *
     * @param id 提现记录ID
     * @return 结果
     */
	public int deleteAppWithdrawalById(Long id);

	/**
     * 批量删除提现记录
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	public int deleteAppWithdrawalByIds(String[] ids);

	/**
	 *
	 * @param userId
	 * @return
	 */
	public HashMap<String, Object> selectAppWithdrawalBybalanceCount(@Param("userId") Long userId, @Param("i") Integer i);

	/**
	 *
	 * @param userId
	 * @param start
	 * @param back
	 * @return
	 */
	public List<AppWithdrawal> selectAppWithdrawalListLIMIT(@Param("userId") Long userId,@Param("start") Integer start,@Param("back") Integer back);

	/**
	 *
	 * @param userId
	 * @return
	 */
	public List<AppWithdrawal> selectAppWithdrawalByUserId(Long userId);

	/**
	 *
	 * @param userId
	 * @return
	 */
	public Integer selectAppWithdrawalCountByUserId(Long userId);

	/**
	 *
	 * @param userId
	 * @return
	 */
	public Double selectAppWithdrawalAmountByUserId(Long userId);

	/**
	 *
	 * @param applicantStatus
	 * @param longStartTime
	 * @param longEndTime
	 * @param keyWord
	 * @return
	 */
	public List<AppWithdrawal> selectAppWithdrawalListByKeyWord(@Param("applicantStatus") Integer applicantStatus, @Param("longStartTime") Long longStartTime,
																@Param("longEndTime") Long longEndTime, @Param("keyWord") String keyWord, @Param("companyId") Integer companyId, @Param("withdrawalType") Integer withdrawalType);

	/**
	 * 
	 * @param hashMap
	 * @return
	 */
	public int updateSum(HashMap<String, Object> hashMap);

	/**
	 * 
	 * @param userId
	 * @return
	 */
	public AppWithdrawal findAppWithdrawalByMoneyDesc(Long userId);

    List<AppWithdrawal> selectAllAppWithdrawa();

	int importUpdateStatus(AppWithdrawalOfMode appWithdrawal);

    List<AppWithdrawal> selectByUserIdAndAmount(@Param("userId") Long userId, @Param("amount") Double amount, @Param("status") Integer status);

	Double statisticsAmount(@Param("companyId")Integer companyId,@Param("flag")Integer flag);

	/**
	 * 查询当天支付宝提现记录数量
	 * @param userId
	 * @return
	 */
    Integer selectAppWithdrawalListOne(@Param("userId")Long userId);

	BigDecimal userAmount(@Param("userId")Long userId);

	Integer statisticsPeopleAmount(@Param("companyId")Integer companyId, @Param("flag")Integer flag);

	Integer statisticsAmountNum(@Param("companyId")Integer companyId, @Param("applicantStatus")Integer applicantStatus, @Param("type")Integer type,
								@Param("startDate")Long startDate,@Param("endDate") Long endDate);

	Double statisticsAmountMoney(@Param("companyId")Integer companyId, @Param("applicantStatus")Integer applicantStatus, @Param("type")Integer type,
								 @Param("startDate") Long startDate, @Param("endDate") Long endDate);

	Double sqjdWithdrawal();

	Double withdrawalAllMoney(@Param("type")Integer type);

	Map<String,Object> withdrawalCommision(@Param("type")Integer type);

	Double sqjdWithdrawalCommision();

	Map<String,Object> withdrawalResultCommision(@Param("type")Integer type, @Param("flag")Integer flag);

	List<String> selectUserIdList();
}